<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<html>
<head>
    <title>CSA发货</title>
    <script>

        $(document).ready(function () {
            getPersonLabel();
        })


         $(function () {
             var list = '${stringList}';
             var list1 = list.toString();
             var newstr=list1.substring(1,list1.length-1);
             var values = $("#ids").val(newstr);
        })
         $(function () {
             var warehouse = $("#deliverWarehouse").val();
             $.ajax({
                 type:"post",
                 dataType:"json",
                 data:{"warehouse":warehouse},
                 url:"cbsDelinerController.do?getWarehousePerson",
                 success:function (data) {
                     var obj = data.obj;
                     if(obj!=null){
                         var  html = "";
                         var name = "";
                         var phone="";
                         var email = "";

                         if (obj.userName==null){
                             name+="";
                         }else {
                             name+=obj.userName;
                         }
                         if (obj.phone==null){
                             phone+="";
                         }else {
                             phone+=obj.phone;
                         }
                         if (obj.email==null){
                             email+="";
                         }else {
                             email+=obj.email;
                         }
                         html+="<span>"+name+"&nbsp;"+phone+"&nbsp;"+email+"<span";
                     }

                     $("#warehousePerson").html(html);
                 }


             })
         })
         function getWarehousePerson() {
             var warehouse = $("#deliverWarehouse").val();
             if(warehouse == '0'){
                 $("#warehousePerson").html("<span>暂无联系人信息</span>");
             }
             $.ajax({
                 type:"post",
                 dataType:"json",
                 data:{"warehouse":warehouse},
                 url:"cbsDelinerController.do?getWarehousePerson",
                 success:function (data) {
                     var obj = data.obj;
                     if(obj!=null){
                         var  html = "";
                         var name = "";
                         var phone="";
                         var email = "";

                             if (obj.userName==null){
                                 name+="";
                             }else {
                                 name+=obj.userName;
                             }
                             if (obj.phone==null){
                                 phone+="";
                             }else {
                                 phone+=obj.phone;
                             }
                             if (obj.email==null){
                                 email+="";
                             }else {
                                 email+=obj.email;
                             }
                             html+="<span>"+name+"&nbsp;"+phone+"&nbsp;"+email+"<span>";
                         }

                         $("#warehousePerson").html(html);
                     }


             })
         }

        
         //二级联动
         function loadCity() {
             var id = $('#province').val();
             $.post('loginWxController.do?getTerritoryCity', {id: id}, function (data) {
                 data = $.parseJSON(data);
                 $('#city').find('option').remove();
                 var str = "<option value=''>--请选择城市--</option>";
                 for (var i = 0; i < data.length; i++) {
                     str += '<option value="' + data[i].id + '">' + data[i].territoryName + '</option>';
                 }
                 $('#city').append(str);
             });
         }
        function getSLAByWarsoue() {
            var logisticsName = $("#logistics").val();
            var cityId = $("#cityId").val();
            var deliverWarehouseId = $("#deliverWarehouse").val();
            if(logisticsName!="" || logisticsName!=null){
                $.ajax({
                    type:"post",
                    data:{"logisticsName":logisticsName,"cityId":cityId,"deliverWarehouseId":deliverWarehouseId},
                    url:"cbsDelinerController.do?getSLAByWarouse",
                    dataType:"json",
                    success:function (data) {
                        var obj = data.obj;
                        if(obj==null){
                            $("#slaType").text("无");
                            $("#wlSLA").val("无");
                        }
                        if(obj!=null){
                            var slaType =  obj.slaType;
                            $("#slaType").text(slaType);
                            $("#wlSLA").val(slaType);
                        }
                    }
                })
            }
        }
         function getSLA() {
             var logisticsName = $("#logistics").val();
             var cityId = $("#cityId").val();
             if(logisticsName!="" || logisticsName!=null){
                 $.ajax({
                     type:"post",
                     data:{"logisticsName":logisticsName,"cityId":cityId},
                     url:"cbsDelinerController.do?getSLA",
                     dataType:"json",
                     success:function (data) {
                         var obj = data.obj;
                         if(obj==null){
                             $("#slaType").text("无");
                             $("#wlSLA").val("无");
                         }
                         if(obj!=null){
                             var slaType =  obj.slaType;
                             $("#slaType").text(slaType);
                             $("#wlSLA").val(slaType);
                         }

                     }
                 })
             }
         }

        function getCang() {

            var cityId = $("#cityId").val();
            var logistics = $("#logistics").val();
            $.ajax({
                type:"GET",
                data:{"cityCode":cityId,"logistics":logistics},
                url:"cbsDelinerController.do?getWarehouseByLogistics",
                dataType:"json",
                success:function (data) {
                    var obj = data.obj;
                    var html = "<option value='0'>--请选择仓库--</option>";
                    for (i in obj){
                        html+="<option value='"+obj[i].id+"'>"+obj[i].name+"</option>";
                    }
                    $("#deliverWarehouse").html(html);
                    getWarehouseContacts();
                }
            })
        }
        function getWarehouseByLogistics() {

            var city = $("#cityId").val();
            var logistics = $("#logistics").val();
            if (logistics=="0"){
                getCang();
            }else {
                $.ajax({
                    type:"post",
                    data:{"cityCode":city,"logistics":logistics},
                    url:"cbsDelinerController.do?getWarehouseByLogistics",
                    dataType:"json",
                    success:function (data) {
                        var tbs = data.obj;

                        if(tbs==null){
                            $("#deliverWarehouse").html("<option value=''>--请选择仓库--</option>");
                            $("#warehousePerson").html('暂无联系人');
                        }else{
                            var html = "<option value='0'>--请选择仓库--</option>";
                            for (i in tbs){
                                html +="<option value='"+tbs[i].id+"'>"+tbs[i].name+"</option>";

                            }
                            $("#deliverWarehouse").html(html);
                            var cityId = $("#cityId").val();
                            if(cityId!=""){
                                $.ajax({
                                    type:"GET",
                                    data:{"cityCode":cityId,"logistics":logistics},
                                    url:"cbsDelinerController.do?getWarehouseByLogisticsForCity",
                                    dataType:"json",
                                    success:function (data) {
                                        var obj = data.obj;
                                        $('#deliverWarehouse option').each(function(){
                                            if($(this).val()==obj[0].id ){
                                                $(this).attr("selected",true);
                                            }
                                        })
                                        getWarehouseContacts();
                                    }
                                })
                            }
 
                        }
                        getWarehouseContacts();
                    }
                })
            }

        }
        /*
    * 获取仓库联系人
    * */
        function getWarehouseContacts(){

            var deliverWarehouseId = $("#deliverWarehouse").val();
            // alert(deliverWarehouseId)
            if(deliverWarehouseId=="0"){
                $("#warehousePerson").html('<label>暂无联系人信息</label>');
            }else{
                $.ajax({
                    type:"GET",
                    data:{"code":deliverWarehouseId},
                    url:"cbsDelinerController.do?getWarehouseContacts",
                    dataType:"json",
                    success:function (data) {
                        var tbs = data.obj;
                        var name=tbs.userName;
                        var phone=tbs.phone;
                        var email=tbs.email;

                        if(tbs.userName==null){
                            name="";
                        }
                        if(tbs.phone==null){
                            phone=="";
                        }
                        if(tbs.email==null){
                            email=="";
                        }
                        if(tbs.email==null && tbs.userName==null &&tbs.phone==null){
                            html = '<label>暂无联系人信息</label>';
                        }else{
                            html = '<label>'+name+'&nbsp &nbsp '+phone+'&nbsp &nbsp'+email+'</label>';
                        }
                        $("#warehousePerson").html(html);
                        console.log("contects:"+tbs)
                    }

                })
            }

        }
         function getPersonLabel() {
             var logistics = $("#logistics").val();
             $.ajax({
                 type:"post",
                 dataType:"json",
                 url:"cbsDelinerController.do?getContacts",
                 data:{"code":logistics},
                 success:function (data) {
                     var tbs = data.obj;
                     //alert("tbs:"+tbs);
                     var html;
                     if(tbs==null || tbs==""){
                         //alert("暂无联系人信息");
                         html = '<label>暂无联系人信息</label>';
                     }else{
                         html = '<label>'+tbs.name+'&nbsp &nbsp '+tbs.cellphone1+'&nbsp &nbsp'+tbs.email+'</label>';
                     }
                     $("#personLabel").html(html);
                     //alert("联系人信息");
                 }
             })

         }
         function getPersonMessage() {
             var return_logistics = $("#return_logistics").val();
             $.ajax({
                 type:"post",
                 dataType:"json",
                 url:"cbsDelinerController.do?getContacts",
                 data:{"code":return_logistics},
                 success:function (data) {
                     var tbs = data.obj;
                     //alert("tbs:"+tbs);
                     var html;
                     if(tbs==null || tbs==""){
                         //alert("暂无联系人信息");
                         html = '<label>暂无联系人信息</label>';
                     }else{
                         html = '<label>'+tbs.name+'&nbsp &nbsp '+tbs.cellphone1+'&nbsp &nbsp'+tbs.email+'</label>';
                     }
                     $("#personMsg").html(html);
                 }
             })
         }


        function checkeNull(obj) {
            //alert("id:"+obj.id)
            //alert("value:"+obj.value)
            var value=obj.value;
            if(value==null || value==''){
                $('#'+obj.id+'Err').show();
            }else {
                $('#'+obj.id+'Err').hide();
            }
        }

    </script>
</head>
<body>
<div><span style="font-weight: bold;">相关信息</span></div>
	<table class="nobordertable noborder">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>服务单号CR:</label>
			</td>
			<td width="30%">
				${cbsDelinerEntity.crCode}
			</td>
			<td class="al_r" width="20%">
				<label>服务单类型:</label>
			</td>
			<td width="30%">
				${servicetype}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>SR:</label>
			</td>
			<td width="30%">
				${cbsDelinerEntity.srCode}
			</td>
			<td class="al_r" width="20%">
				<label>SO:</label>
			</td>
			<td width="30%">
				${cbsDelinerEntity.soCode}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>备件申请单号:</label>
			</td>
			<td width="30%">
				${cbsDelinerEntity.spaceNumber}
			</td>
           <td class="al_r" width="20%">
                <label>备件申请人:</label>
            </td>
            <td width="30%">
                ${cbsDelinerEntity.equipmentApplyId.createName}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>备件申请备注:</label>
            </td>
            <td width="30%">
                ${cbsDelinerEntity.equipmentApplyId.memo}
            </td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>发货单号:</label>
			</td>
			<td width="30%">
				${cbsDelinerEntity.code}
			</td>
			<td class="al_r" width="20%">
				<label>发货单类型:</label>
			</td>
			<td width="30%">
				<c:forEach items="${deliverTypeList}" var="tsType">
					<c:if test="${tsType.typecode==cbsDelinerEntity.deliverType}">
						${tsType.typename}
					</c:if>
				</c:forEach>
			</td>
		</tr>
		</tbody>
	</table>
<div><span style="font-weight: bold;">发货单</span></div>
<div class="line"></div>
<input type="hidden" value="${stringList}" id="stringList"/>
<table class="ftable">
    <tbody>
    <tr>
        <th>备件类型</th>
        <th>备件号</th>
        <th>备件序列号</th>
        <th>数量</th>
        <th>优先级</th>
        <th>是否返件</th>
    </tr>
    <c:forEach items="${cbsDeliverEquipmentEntityList}" var="deliver">
        <tr>
            <td>${deliver.typeDes}</td>
            <td>${deliver.item}</td>
            <td>${deliver.sn}</td>
            <td>${deliver.total}</td>
            <td>
                <c:if test="${deliver.applyLayer==1}">低</c:if>
                <c:if test="${deliver.applyLayer==2}">中</c:if>
                <c:if test="${deliver.applyLayer==3}">高</c:if>
                <c:if test="${deliver.applyLayer==4}">加急</c:if>
            </td>
            <td>
                <c:if test="${deliver.isReturn!=2}">否</c:if>
                <c:if test="${deliver.isReturn==2}">是</c:if>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="line"></div>
<form id="myform" name="myform">
    <input type="hidden" name="srCode" value="${cbsDelinerEntity.srCode}"/>
    <input type="hidden" name="soCode" value="${cbsDelinerEntity.soCode}"/>
    <input type="hidden" name="crCode" value="${cbsDelinerEntity.crCode}"/>
    <input type="hidden" name="status" value="${cbsDelinerEntity.status}"/>
    <input type="hidden" name="id" value="${cbsDelinerEntity.id}"/>
    <input type="hidden" id="ids" name="EquipmentIds"/>
    <input type="hidden" value="${cbsDelinerEntity.sheng.id}" name="sheng.id"/>
    <input type="hidden" value="${cbsDelinerEntity.shi.id}" name="shi.id"/>
    <input type="hidden" value="${cbsDelinerEntity.address}" name="address"/>
    <input type="hidden" value="${cbsDelinerEntity.code}" name="code"/>
    <input type="hidden" value="${cbsDelinerEntity.equipmentApplyId.id}" name="equipmentApplyId.id"/>
    <input type="hidden" value="${cbsDelinerEntity.deliverType}" name="deliverType"/>
    <input type="hidden" value="${cbsDelinerEntity.createBy}" name="createBy"/>
    <input type="hidden" value="${cbsDelinerEntity.createDate}" name="createDate"/>
    <input type="hidden" value="${cbsDelinerEntity.createName}" name="createName"/>
    <input type="hidden" value="${cbsDelinerEntity.spaceNumber}" name="spaceNumber"/>
    <div><span style="font-weight: bold;">收货人</span></div>
<table class="nobordertable noborder" style="border: none;">
    <tbody>
    <tr>
        <td class="al_r" width="20%">
            <label>姓名:</label>
        </td>
        <td width="30%">
            ${cbsDelinerEntity.userName}
            <input type="hidden" value="${cbsDelinerEntity.userName}" id="username" name="userName"/>
        </td>
        <td class="al_r" width="20%">
            <label>电话:</label>
        </td>
        <td width="30%">
            ${cbsDelinerEntity.phone}
            <input type="hidden" value="${cbsDelinerEntity.phone}" name="phone"/>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%">
            <label>收货地址:</label>
        </td>
        <td width="40%">
            <input type="hidden" value="${cbsDelinerEntity.shi.id}" id="cityId" />
            ${cbsDelinerEntity.sheng.territoryName} ${cbsDelinerEntity.shi.territoryName} ${cbsDelinerEntity.address}

        </td>
        <c:if test="${cbsDelinerEntity.zt ==1}">
            <td class="al_r" width="20%">
                <label>自提仓库:</label>
            </td>
            <td width="20%">
                ${cbsDelinerEntity.warehouseId.name}
            </td>
        </c:if>
    </tr>
    <tr>
        <td class="al_r" width="20%">
            <label>影院名称:</label>
        </td>
        <td width="30%">
            ${cbsDelinerEntity.cinemaName}
                <input  type="hidden" value="${cbsDelinerEntity.cinemaName}" name="cinemaName"/>
        </td>
        <td class="al_r" width="20%">
            <label>是否自提:</label>
        </td>
        <td width="30%">
            <c:if test="${cbsDelinerEntity.zt ==1}">是</c:if>
            <c:if test="${cbsDelinerEntity.zt ==2}">否</c:if>
            <input  type="hidden" value="${cbsDelinerEntity.zt}" name="zt"/>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%" valign="top">
            <label>CSA注意事项:</label>
        </td>
        <td colspan="3">
            <textarea style="width: 100%; height: 60px;" id="logisticsMemo" readonly="readonly" >${cbsDelinerEntity.equipmentApplyId.csaAttention}</textarea>
        </td>
    </tr>
    </tbody>
</table>
<div><span style="font-weight: bold;">选择发货物流</span></div>
<table class="nobordertable noborder" style="border: none;">
    <tbody>
    <tr>
        <td class="al_r" width="20%">
            <label>物流:</label>
        </td>
        <td width="30%">
            <input type="hidden" value="${cbsWarehouseEntityList}" id="priority">
            <font color="red">*</font><select id="logistics" onchange="getSLA();getPersonLabel();getWarehouseByLogistics()" name="deliverLogistics">
                <option value="0">--请选择物流--</option>
                <c:forEach items="${tsDepartList}" var="tsDe">
                    <option value="${tsDe.departname}" <c:if test="${cbsDelinerEntity.deliverLogistics == tsDe.departname}">selected="selected"</c:if>>${tsDe.departname}</option>
                </c:forEach>
            </select>
        </td>
        <td class="al_r" width="20%">
            <label>联系人:</label>
        </td>
        <td width="30%">
            <span id="personLabel"></span>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%">
            <label>仓库:</label>
        </td>
        <td width="30%">
            <input type="hidden" value="${cbsWarehouseEntity.name}" id="cbsWarehouseEntity"/>
            <font color="red">*</font> <select id="deliverWarehouse" name="deliverWarehouseId.id" onchange="getWarehousePerson();getSLAByWarsoue()" onkeyup="checkeNull(this);">
                <option value="0">--请选择仓库--</option>
                <c:forEach items="${wareList}" var="ware">
            <option value="${ware.id}" <c:if test="${ware.id == cbsDelinerEntity.deliverWarehouseId.id}">selected="selected"</c:if> >${ware.name}</option>
                </c:forEach>
            </select>
            <span id="deliverWarehouseErr" hidden="hidden" style="color: red;font-size: 10px">仓库不能为空</span>
        </td>
        <td class="al_r" width="20%">
            <label>联系人:</label>
        </td>
        <td width="30%">
           <span id="warehousePerson">${cbsDelinerEntity.deliverWarehouseId.userName}&emsp;${cbsDelinerEntity.deliverWarehouseId.phone}&emsp;${cbsDelinerEntity.deliverWarehouseId.email}</span>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%">
            <input type="hidden" value="${slaId}" id="sla"/>
            <label>物流承诺SLA:</label>
        </td>
        <td colspan="3">
            <span id="slaType">${cbsDelinerEntity.wlSLA}</span>
            <input type="hidden" name="wlSLA" id="wlSLA" value="${cbsDelinerEntity.wlSLA}"/>
        </td>

    </tr>
    <tr>
        <td class="al_r" width="20%">
            <label>库位:</label>
        </td>
        <td width="30%">
            <font color="red">*</font><select name="wLocaltion">
                <c:forEach items="${types}" var="types">
                    <option value="${types.typecode}" <c:if test="${types.typecode==cbsDelinerEntity.wLocaltion}">selected="selected"</c:if>>${types.typename}</option>
                </c:forEach>
            </select>
        </td>
        <td class="al_r" width="20%">
            <label>发货SLA:</label>
        </td>
        <td width="30%">
            <font color="red">*</font><select name="fhSLA">
                <c:forEach items="${fhSLAs}" var="sla">
                    <option <c:if test="${sla.typecode==cbsDelinerEntity.fhSLA}">selected="selected"</c:if> value="${sla.typecode}">${sla.typename}</option>
                </c:forEach>

            </select>
        </td>
    </tr>

    <tr>
        <td class="al_r" width="20%" valign="top">
            <label>发货说明:</label>
        </td>
        <td colspan="3">
            <textarea style="width: 100%; height: 60px;" name="deliverDes" >${cbsDelinerEntity.deliverDes}</textarea>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%" valign="top">
            <label>物流提货地址:</label>
        </td>
        <td colspan="3">
            <select style="width: auto;" id="province" onchange="loadCity()" name="thSheng.id">
                <option value="">--请选择省份--</option>
                <c:forEach items="${territoryList }" var="terr">
                    <option <c:if test="${terr.id==cbsDelinerEntity.thSheng.id}">selected="selected"</c:if> value="${terr.id }" >${terr.territoryName }</option>
                </c:forEach>
            </select>
            <select style="width: auto;" id="city" name="thCity.id">
                <option value="">--请选择城市--</option>
                <c:if test="${not empty cityList}">
                    <c:forEach items="${cityList}" var="city">
                        <option <c:if test="${city.id==cbsDelinerEntity.thCity.id}">selected="selected"</c:if>  value="${city.id}">${city.territoryName}</option>
                    </c:forEach>
                </c:if>
            </select>
            <input style="width: 500px" name="thAddress" id="thAddress" value="${cbsDelinerEntity.thAddress}"/>
        </td>
    </tr>
    <tr>
        <td class="al_r" width="20%"></td>
        <td>
            <font color="red">*仅限非物流仓库发货时填写</font>
        </td>

    </tr>
    </tbody>
</table>

<div><span style="font-weight: bold;">选择返件物流</span></div>
<table class="nobordertable noborder" style="border: none;">
    <tbody>
    <tr>
        <td class="al_r" width="20%">
            <label>物流:</label>
        </td>
        <td width="30%">
            <input name="tempLogistics" type="hidden" value="${cbsDelinerEntity.returnLogistics}"/>
            <input type="hidden" id="returnLogistics" name="returnWuliu"/>
            <select id="return_logistics" name="returnLogistics" onchange="getPersonMessage()<c:if test="${isReturnCount>0}">;checkeNull(this)</c:if>">
                <option value="">--请选择--</option>
                <c:forEach items="${tsDepartList}" var="tsDe">
                    <option value="${tsDe.departname}" <c:if test="${cbsDelinerEntity.returnLogistics == tsDe.departname}">selected="selected"</c:if>>${tsDe.departname}</option>
                </c:forEach>
            </select>
            <span id="return_logisticsErr" hidden="hidden" style="color: red;font-size: 10px">返件物流不能为空</span>
        </td>
        <td class="al_r" width="20%">
            <label>联系人:</label>
        </td>
        <td width="30%">
            <span id="personMsg">${returnContacts.name}&emsp;${returnContacts.cellphone1}&emsp;${returnContacts.email}</span>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="text-align: right;">
            <a onclick="sendHuo()" id="btn" class="easyui-linkbutton l-btn">发货</a>
            <%--<a id="fhButton" onclick="sendHuo()" class="easyui-linkbutton l-btn">发货</a>--%>
        </td>
    </tr>
    </tbody>
</table>
</form>
</body>
<script>
    $(function () {
        $("#btn").css("pointer-events","auto");
    })
    function sendHuo() {
        $("#btn").css("pointer-events","none");
        var status = ${cbsDelinerEntity.status};
        var code = $("input[name = 'code']").val();
        var closeText = 'CSA发货'+code;
        var thAddress=$('#thAddress').val();
        var deliverWarehouse=$('#deliverWarehouse').val();
        var return_logistics=$('#return_logistics').val();
        if (status==2){
            tip("该发货单已发货");
            $("#btn").css("pointer-events","auto");
            return false;
        }
        if (status==3){
            tip("该发货单已取消发货");
            $("#btn").css("pointer-events","auto");
            return false;
        }
        if (status==4){
            tip("该发货单已标记欠货");
            $("#btn").css("pointer-events","auto");
            return false;
        }
        if (status==7){
            tip("该发货单已签收");
            $("#btn").css("pointer-events","auto");
            return false;
        }
        if(deliverWarehouse=='0'){
            $('#deliverWarehouseErr').show()
            parent.window.tip("请选择仓库");
            $("#btn").css("pointer-events","auto");
            return false;
        }
        if(${isReturnCount>0}){
            if(return_logistics==null || return_logistics=='' || return_logistics=='0'){
                $('#return_logisticsErr').show()
                parent.window.tip("请选择返件物流");
                $("#btn").css("pointer-events","auto");
                return false;
            }
        }
        if (status==1 || status==5 || status==6){
            $.ajax({
                type:"post",
                dataType:"json",
                data:$("#myform").serialize(),
                url:"cbsDelinerController.do?sendHuo",
                success:function (data) {
                    var obj = data.attributes;
                    if(obj.sta==1&&data.success){
                        tip("操作成功");
                        setTimeout("  addOneTab(\"发货管理\",'cbsDelinerController.do?cbsDeliner');",1000);
                        setTimeout("closetab('"+closeText+"')",1000);
                    }else {
                        tip(data.msg);
                    }
                }
            })
        }

    }
</script>
</html>
